package com.qinggeng.project.system.service.impl;

import com.qinggeng.common.enums.CommonEnum;
import com.qinggeng.common.utils.DateUtils;
import com.qinggeng.project.system.domain.SysLeague;
import com.qinggeng.project.system.mapper.SysLeagueMapper;
import com.qinggeng.project.system.service.ISysLeagueService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 加盟信息Service业务层处理
 *
 * @author qinggeng
 * @date 2020-05-28
 */
@Service
public class SysLeagueServiceImpl implements ISysLeagueService
{
    @Resource
    private SysLeagueMapper sysLeagueMapper;

    /**
     * 查询加盟信息
     *
     * @param leagueId 加盟信息ID
     * @return 加盟信息
     */
    @Override
    public SysLeague selectSysLeagueById(Long leagueId)
    {
        return sysLeagueMapper.selectSysLeagueById(leagueId);
    }

    /**
     * 查询加盟信息列表
     *
     * @param sysLeague 加盟信息
     * @return 加盟信息
     */
    @Override
    public List<SysLeague> selectSysLeagueList(SysLeague sysLeague)
    {
        return sysLeagueMapper.selectSysLeagueList(sysLeague);
    }

    /**
     * 新增加盟信息
     *
     * @param sysLeague 加盟信息
     * @return 结果
     */
    @Override
    public int insertSysLeague(SysLeague sysLeague)    {
        sysLeague.setStatus(CommonEnum.STATUS_10.getValue());
        sysLeague.setCreateTime(DateUtils.getNowDate());
        return sysLeagueMapper.insertSysLeague(sysLeague);
    }

    /**
     * 修改加盟信息
     *
     * @param sysLeague 加盟信息
     * @return 结果
     */
    @Override
    public int updateSysLeague(SysLeague sysLeague)
    {
        sysLeague.setUpdateTime(DateUtils.getNowDate());
        return sysLeagueMapper.updateSysLeague(sysLeague);
    }

    /**
     * 批量删除加盟信息
     *
     * @param leagueIds 需要删除的加盟信息ID
     * @return 结果
     */
    @Override
    public int deleteSysLeagueByIds(Long[] leagueIds)
    {
        return sysLeagueMapper.deleteSysLeagueByIds(leagueIds);
    }

    /**
     * 删除加盟信息信息
     *
     * @param leagueId 加盟信息ID
     * @return 结果
     */
    @Override
    public int deleteSysLeagueById(Long leagueId)
    {
        return sysLeagueMapper.deleteSysLeagueById(leagueId);
    }
}
